LinkedList Implementation ========================= Implementation issues: What instance variables are needed inside a LinkedList object? What variables are needed inside a Node on the list? How do you add an item to the front of a LinkedList? How do you add an item to the end of a LinkedList? How do you find the end of a LinkedList? Can you use an instance variable to help find the end of the list? How do you compute the size of a LinkedList? Can you use an instance variable to improve the size computation? How do you get the item at a specified position on a LinkedList? How do you determine if a LinkedList contains an item? How do you find an item on a LinkedList? How do you set the value of a specified position on a LinkedList? How do you remove an item from a LinkedList? What instance variables are needed to iterate over a LinkedList? How do you implement a LinkedList iterator? (a) LinkedList-single.java (singly-linked, only pointer to head) Complexity issues: What's the Big-Oh bound for add/remove/find/set/get? Using a Header Node ------------------- What is a header node? A node whose purpose is to hold the start of the list (b) LinkedList-header.java How do the following change when using a header node? Constructor Add method Remove method Iterator methods How does the header node improve the class? Linking Both Ways ----------------- What's a doubly-linked list? Each node knows both its predecessor and successor (b) LinkedList-double.java (doubly-linked, pointers to head and tail) How do the following change when using a header node? Constructor If the list has double links and a header node, what else should it have? What does an empty list look like? Add method Remove method Iterator methods How do double links improve the class?